package com.aivin.tvslidebar.activity;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

/**
 *
 adb shell am broadcast  -a  key_aotoScan_device_action --ei KeyCode   1 -n "com.aivin.tvslidebar/com.aivin.tvslidebar.activity.TestCmdReceiver"
 */
public class TestCmdReceiver extends BroadcastReceiver {
    public static final String KEY_AOTOSCAN_DEVICE_ACTION="key_aotoScan_device_action" ;
    public static final String KEY_OPEN_ENV_ACTION="key_open_env_action20221213" ;
    public static final String KEY_GET_VOICE_DATA="key_get_voice_data" ;
    public static final String KEY_GET_ASR_DATA="key_get_asr_data" ;

    @Override
    public void onReceive(Context context, Intent intent) {

        String action = intent.getAction();
        if (KEY_AOTOSCAN_DEVICE_ACTION.equals(action)) {
            LyLog.showLog("收到自动扫描模拟指令");

            sendBroadCast(context);
        }
    }

    public  void sendBroadCast(Context context ) {
        Intent intent = new Intent();
        intent.setPackage("com.cam.rising_car");
        intent.setAction("android.intent.action.ca.hardkey.ddpai");
        // 1 代表拍照
        intent.putExtra("KeyCode",1) ;
        context.sendBroadcast(intent);

        LyLog.showLog( "广播已发送");
    }

}